<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>


<div class="container">
	<div class="modal fade" id="myModal">
		<div class="modal-dialog">
			<div class="modal-content modal-wrap">
				<img src="" width="100%" height="100%" />
				<button type="button" class="close" data-dismiss="modal">&times;</button>
			</div>
		</div>
	</div>
</div>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group hidden-xs" id="toolbar" role="group">
			<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="module:banner:add">
				<i class="fa fa-plus"></i> 新增
			</a>
			<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="module:banner:remove">
				<i class="fa fa-trash-o"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-info table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:banner:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module:banner:remove')}]];
        var datas = [[${@dict.getType('app_type')}]];
        var prefix = ctx + "module/banner"

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "电影广告图",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '' 
				},
				{
					field : 'title', 
					title : '标题' 
				},
				{
					field : 'url', 
					title : '跳转链接' 
				},
				{
					field : 'image', 
					title : '图片地址',
                    formatter: function(value, item, index) {
                        var actions = [];
                        actions.push("<img  src='"+value+"' height=\"100px\" width=\"200px\" onclick=\"toBig(this)\">");
                        return actions.join('');
                    }
				},
				{
					field : 'type', 
					title : '类型' 
				},
				{
					field : 'createTime',
					title : '添加时间'
				},
                  /*  {
                        field : 'appType',
                        title : '平台',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(datas, value);
                        }
                    },*/
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
	<script>
        function toBig(obj){
            var Url = obj.src;//获取当前地址
            $("#myModal img").attr('src',Url)//赋值给新模态框
            $('#myModal').modal('show')
        }
	</script>
</body>
</html>